﻿@using TomNet.IMSC.Model.DbModels.Finance
@using TomNet.IMSC.Web.Areas.Finance.Models
@{
    var entity = ViewData["entity"] as FinanceRunnings;
    Layout = null;
}


<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <link href="~/Content/Css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="~/Content/Css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="~/Content/Css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
    <link href="~/Content/Css/animate.css" rel="stylesheet">
    <link href="~/Content/Css/style.css?v=4.1.0" rel="stylesheet">
    <title>edit</title>
    <link href="~/Content/Css/plugins/iCheck/custom.css" rel="stylesheet" />
    <link href="~/Content/common.css" rel="stylesheet" />
    <style>
        .form-group {
            margin-bottom: 15px;
            height: 39px;
        }
    </style>
</head>
<body>
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-xs-12">
                <form class="form-horizontal m-t" id="mainForm">

                    <input type="hidden" id="Id" name="Id" value="@entity.Id" />
                    <input type="hidden" id="Progress" name="Progress" value="@entity.Progress" />
                    <input type="hidden" id="td_val" name="td_val" value="@entity.TransferDetailed" />

                    @if (entity.Progress == 2)
                    {
                        <div class="form-group">
                            <label class="col-xs-4 control-label">选项：</label>
                            <div class="col-xs-8">
                                <div class="radio i-checks radio-inline">
                                    <label class="" style="padding-left: 0px;">
                                        <div class="iradio_square-green" style="position: relative;">
                                            <input type="radio" value="0" name="TransferDetailed" style="position: absolute; opacity: 0;">
                                            <ins class="iCheck-helper" style="position: absolute; top: 0%; left: 0%; display: block; width: 100%; height: 100%; margin: 0px; padding: 0px; border: 0px; opacity: 0; background: rgb(255, 255, 255);"></ins>
                                        </div> <i></i><span class="glyphicon glyphicon-star" aria-hidden="true" style="color:red;"></span>未转
                                    </label>
                                </div>
                                <div class="radio i-checks radio-inline">
                                    <label class="">
                                        <div class="iradio_square-green" style="position: relative;">
                                            <input type="radio" value="1" name="TransferDetailed" style="position: absolute; opacity: 0;">
                                            <ins class="iCheck-helper" style="position: absolute; top: 0%; left: 0%; display: block; width: 100%; height: 100%; margin: 0px; padding: 0px; border: 0px; opacity: 0; background: rgb(255, 255, 255);"></ins>
                                        </div> <i></i> <span class="glyphicon glyphicon-star" aria-hidden="true" style="color:green;"></span>已转
                                    </label>
                                </div>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-xs-4 control-label">备注：</label>
                            <div class="col-xs-8">
                                <textarea type="text" id="TransferDetailedRemark" name="TransferDetailedRemark" class="form-control m-b" rows="3" placeholder="请输入备注信息">@entity.TransferDetailedRemark</textarea>
                            </div>
                        </div>
                    }
                    else if (entity.Progress == 1)
                    {
                        <div class="form-group">
                            <label class="col-xs-4 control-label">备注：</label>
                            <div class="col-xs-8">
                                @*<input id="Remark" name="Remark" value="@entity.Remark" readonly type="text" class="form-control">*@
                                <textarea type="text" id="Remark" name="Remark" class="form-control m-b" rows="3" placeholder="请输入备注信息">@entity.Remark</textarea>
                            </div>
                        </div>

                    }
                    else if (entity.Progress == 9)
                    {
                        <div class="form-group">
                            <label class="col-xs-4 control-label">客户名称：</label>
                            <div class="col-xs-8">
                                <input id="CustomerName" name="CustomerName" value="@entity.CustomerName" type="text" class="form-control">
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-xs-4 control-label">客户电话：</label>
                            <div class="col-xs-8">
                                <input id="CustomerPhone" name="CustomerPhone" value="@entity.CustomerPhone" readonly type="text" class="form-control">
                            </div>
                        </div>
                    }
                    else if (entity.Progress == 10)
                    {
                        <div class="form-group">
                            <label class="col-xs-4 control-label">客户名称：</label>
                            <div class="col-xs-8">
                                <input id="CustomerName" name="CustomerName" value="@entity.CustomerName" readonly type="text" class="form-control">
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-xs-4 control-label">客户电话：</label>
                            <div class="col-xs-8">
                                <input id="CustomerPhone" name="CustomerPhone" value="@entity.CustomerPhone" type="text" class="form-control">
                            </div>
                        </div>
                    }
                    <div class="form-group">

                        <label class="col-xs-4 control-label"></label>
                        <div class="col-xs-8">
                            <button id="submit" class="btn btn-primary pull-right m-t" type="submit">
                                <i class="fa fa-check"></i>&nbsp;提&nbsp;交
                            </button>
                        </div>
                        

                    </div>

                </form>
            </div>
        </div>
    </div>
    <!-- 全局js -->
    <script type="text/javascript" src="~/Scripts/jquery.min.js?v=2.1.4"></script>
    <script type="text/javascript" src="~/Scripts/bootstrap.min.js?v=3.3.6"></script>

    <!-- jQuery Validation plugin javascript-->
    <script type="text/javascript" src="~/Scripts/plugins/validate/jquery.validate.min.js"></script>
    <script type="text/javascript" src="~/Scripts/plugins/validate/messages_zh.min.js"></script>
    <script type="text/javascript" src="~/Scripts/Extensions/ExtValidator.js"></script>

    <!-- layer javascript -->
    <script type="text/javascript" src="~/Scripts/plugins/layer/layer.min.js"></script>
    <script src="~/Scripts/plugins/iCheck/icheck.min.js"></script>
    <script>
        $(function () {

            //初始默认选中 radio
            $("input[type='radio']").each(function () {
                if ($(this).val() == $('#td_val').val()) {
                    $(this).prop("checked", true);
                }
            });

            $('.i-checks').iCheck({//CheckBox 初始化
                //checkboxClass: 'icheckbox_square-green',
                radioClass: 'iradio_square-green',
                labelHover: false,
                cursor: true
            });

            // validate signup form on keyup and submit
            var icon = "<i class='fa fa-times-circle'></i> ";
            var validator = $("#mainForm").validate({
                //rules: {
                //    Name: {
                //        required: true,
                //        minlength: 2
                //    }
                //},
                //messages: {
                //    Name: {
                //        required: icon + "请输入您的用户名",
                //        minlength: icon + "用户名必须两个字符以上"
                //    }
                //},
                submitHandler: function (form) {
                    //进行ajax传值

                    console.log($('#mainForm').serialize());
                    $.ajax({
                        url: "/finance/running/EditAsyncBy",
                        type: "post",
                        dataType: "json",
                        data: $('#mainForm').serialize(),//{entity:3},//
                        success: function (data) {
                            //Info,Success,Warning,Error
                            var type = data.type;
                            if (type == 1) {
                                layer.msg(data.content, { icon: 6, time: 2000 },
                                    function () {
                                        var index = parent.layer.getFrameIndex(window.name);
                                        parent.layer.close(index);
                                    });

                            } else {
                                layer.msg(data.content, { icon: 5, time: 2000 });
                            }
                        }
                    });
                }
            });
        });
    </script>
</body>
</html>
